import request from '@/axios'
import Cookies from 'js-cookie'

// 下单接口
export const placeOrder = (params: {
  skuList: { skuId: number; qty: number }[]
  remark: string
}) => {
  const data = {
    token: Cookies.get('user_token'),
    ...params
  }
  return request.post({ url: '/order/create', data })
}

// 订单详情接口
export const getOrderDetail = (orderNo: string) => {
  return request.get({ url: '/order/detail/' + orderNo })
}

// 用户订单列表
export const getUserOrderPageList = (params: any) => {
  params.token = Cookies.get('user_token')
  return request.get({ url: '/order/user/list', params })
}
